home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ Jul 89 / W0003-Re Opening under…-Jul89 < prev    next >
Encoding:
Text File  |  1989-07-12  |  2.2 KB  |  52 lines  |  [TEXT/GEOL]

  1. Item    3925708                         2-July-89        22:27
  2.  
  3. From:   KNEPPER                         Knepper, Christopher
  4.  
  5. To:     MCDONOUGH                       McDonough, Thomas
  6.  
  7. cc:     MACAPP.TECH$                    MACAPP Tech
  8.  
  9. Sub:    Re: Opening under…
  10.  
  11. Tom,
  12.  
  13. Knowing more about how MF tricks an app to open a doc while it's running might
  14. help your debugging efforts. Basically, when the app is already running and the
  15. user tries to open one of its doc's from the Finder, MF tricks app's into
  16. opening their doc's by patching several traps and posting an event.
  17.  
  18. First, MF patches out SFGetFile and MenuSelect. Then MF switches in the app and
  19. posts a mouseDown in the menubar. When the app gets the mouseDown in the
  20. menubar, the app's main event loop calls MenuSelect. MF's patch to MenuSelect
  21. immediately returns (the user never sees MenuSelect's user interface, ie. menus
  22. being displayed). The MenuSelect patch informs the app's main event loop that
  23. the user selected "Open" (or "Open Collection" - whatever is specified in the
  24. MSTR resource). At this point, MF removes its MenuSelect patch. The app's main
  25. event loop next calls SFGetFile. However, MF's patch to SFGetFile immediately
  26. returns (the user never sees SFGetFile's user interface, ie. a get file dialog
  27. box). The SFGetFile patch informs the app's main event loop that the user
  28. selected the file that was opened from the Finder. At this point, MF removes
  29. its SFGetFile patch.
  30.  
  31. The app now knows everything necessary to open the file that was opened from
  32. the Finder.
  33.  
  34. The reason I explain this is that there might be some custom processing in your
  35. main event loop that might interfere with MF's tricks. If you override any of
  36. the following, you should probably check your methods carefully:
  37.  
  38. PROCEDURE TApplication.DispatchEvent(VAR theEventInfo: EventInfo;
  39.                                                      VAR commandToPerform: TCommand);
  40. PROCEDURE TApplication.HandleEvent(VAR theEvent: EventRecord);
  41. PROCEDURE TApplication.MainEventLoop;
  42.                 FUNCTION TApplication.GetEvent(eventMask: INTEGER; sleep: LONGINT;
  43.                                                cursorRgn: RgnHandle;
  44.                                                VAR anEvent: EventRecord): BOOLEAN;
  45.                 FUNCTION TApplication.HandleMouseDown(VAR theEventInfo: EventInfo):
  46. TCommand;
  47.  
  48. Good luck,
  49. -Chris
  50.  
  51.  
  52.